<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %><%--
  Created by IntelliJ IDEA.
  User: 陈敏琴
  Date: 2025/9/24
  Time: 14:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>服务器当前时间</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f2f5;
        }
        .time-container {
            font-size: 3rem;
            padding: 20px 40px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
            color: #333;
        }
        .title {
            color: #666;
            margin-bottom: 20px;
        }
    </style>
    <!-- 设置页面每秒自动刷新 -->
    <meta http-equiv="refresh" content="1">
</head>
<body>
<h1 class="title">服务器当前时间</h1>
<div class="time-container">
    <%
        // 获取当前服务器时间
        Date now = new Date();
        // 设置时间格式为yyyy-MM-dd HH:mm:ss
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String formattedTime = sdf.format(now);
        // 输出格式化后的时间
        out.print(formattedTime);
    %>
</div>
</body>
</html>
